
InitFormBaoCao = {
		urlSubmit: "/AnGiang-557-portlet/html/baocao/ajaxBaocao.jsp",
		initViewBaocao: function(){
			InitFormBaoCao.initDanhMucNhom();
			//InitFormBaoCao.initQuytrinh(1);
			InitFormBaoCao.onchangecbbNhom();
			//InitFormBaoCao.initTableBaocao("search");
		},
		initDanhMucNhom:function(){
			$.ajax({
				type:"POST",
				url:InitFormBaoCao.urlSubmit,
				data:"attr=getdanhmucnhom&username=" + $("#txtUsername").val(),
				async:false,
				success:function(data){
					var firstrow = "<option value='0'>--Chọn--</option>";
					var roleuser = $("#txtRoleuser").val();
					if(roleuser == 0){
						$("#cbbnhom").html(firstrow + data);
					}else{
						$("#cbbnhom").html(data);
					}
					$("#cbbnhom").uniform();
				}
			});
		},
		initQuytrinh:function(manhom){
			if(manhom == 0){
				$("#cbbquytrinh").html("<option value='0'>--Chọn--</option>");
			} else {
				$.ajax({
					type:"POST",
					url:InitFormBaoCao.urlSubmit,
					data:"attr=getquytrinh&manhom=" + manhom,
					async:false,
					success:function(data){
						var firstrow = "<option value='0'>--Chọn--</option>";
						$("#cbbquytrinh").html(firstrow + data);
					}
				});
			}
			$("#cbbquytrinh").uniform();
		},
		onchangecbbNhom:function(){
			var manhom = $('#cbbnhom').val();
			InitFormBaoCao.initQuytrinh(manhom);
			InitFormBaoCao.onchangecbbQuytrinh();
		},
		onchangecbbQuytrinh:function(){
			//var maquytrinh = $('#cbbquytrinh').val();
			//InitFormBaoCao.initHoso(maquytrinh);
			InitFormBaoCao.getTableBaocao();
		},
		initTableBaocao: function(typetable, mahoso, maquytrinh, manhom){
			$.ajax({
				type : "post",
				url : "/AnGiang-557-portlet/html/baocao/ViewBaoCao.jsp",
				data : {type:typetable, mahoso: mahoso, maquytrinh: maquytrinh, manhom: manhom},
				async : false,
				success : function(n) {
					$('#table-content').empty();
					$('#table-content').append(n.trim());
				},
				error : function() {}
			});
			
			$("#results").tablesorter({
				widthFixed : true,
				widgets : [ 'zebra' ]
			}).tablesorterPager({
				container : $("#pager"),
				size : 10
			});
			$('#footer-page').hide();
		},
		getTableBaocao: function(){
			var maquytrinh = $('#cbbquytrinh').val();
			var mahoso = $('#txtMahoso').val();
			var manhom = $('#cbbnhom').val();
			InitFormBaoCao.initTableBaocao("search",mahoso,maquytrinh, manhom);
		}
};






